function testInStock(itemId) {
    var url = '../cart/testInStock?workingItemId=' + itemId;
    $.ajax({
        url: url,
        type: "get",
        async: false,
        dataType: "text",
        success: function (data) {
            if(data == "false") //若无库存，弹出弹窗
                alert("该宠物库存不足，无法加入购物车。");
            else{
                //有库存，才正常走添加的道路
                console.log("有库存");
                window.location.href="../cart/addItemToCart?workingItemId="+itemId;
            }
        }
    });
}
